<%@ page pageEncoding="UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>

<div id="main" style="width: 600px;height:400px;"></div>

<script src="${path}/main/js/echarts.js"></script>
<script>

    //声明一个数组变量
    var array = [];

    $.get(
        "${path}/User/querySexCount",
        function(data){
            var array = [];
            for (name in data) {
                var value = data[name];
                console.log(value);
                array.push({name,value});
            }
            console.log(array);



            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'));
            myChart.setOption({
                series : [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius: '55%',
                        data:array
                    }
                ]
            })


        },"json"
    );




</script>

